﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" 
CodeBehind="Publications.aspx.cs" Inherits="ElectronicJournal.Account.EditorAccount.Publications" %>
<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">

    <asp:SqlDataSource ID="SqlDataSource1" runat="server" 
        ConnectionString="<%$ ConnectionStrings:ApplicationServices %>" 
        SelectCommand="SELECT [dbo].[aspnet_Roles].RoleId, [dbo].[aspnet_UsersInRoles].UserId, [dbo].[aspnet_UsersInRoles].RoleId, [dbo].[aspnet_Users].UserName FROM [dbo].[aspnet_Roles], [dbo].[aspnet_UsersInRoles],  [dbo].[aspnet_Users]  WHERE [dbo].[aspnet_Roles].RoleName = 'Reviewer' AND [dbo].[aspnet_UsersInRoles].RoleId = [dbo].[aspnet_Roles].RoleId AND  [dbo].[aspnet_Users].UserId = [dbo].[aspnet_UsersInRoles].UserId">
        </asp:SqlDataSource>

    <asp:SqlDataSource ID="SqlDataSource2" runat="server" 
        ConnectionString="<%$ ConnectionStrings:ApplicationServices %>" 
        SelectCommand="SELECT Publications.TitleRussian, Publications.Id FROM Publications WHERE State = 1 OR State = 3" />

    <asp:SqlDataSource ID="SqlDataSource3" runat="server" 
        ConnectionString="<%$ ConnectionStrings:ApplicationServices %>" 
        SelectCommand="SELECT ReviewerFirstName, ReviewerLastName, ReviewerThirdName, ReviewerResearchArea, ReviewerPhoneNumber, ReviewerEmail, ReviewerId FROM Reviewer"></asp:SqlDataSource>

    <asp:SqlDataSource ID="SqlDataSource4" runat="server" 
        ConnectionString="<%$ ConnectionStrings:ApplicationServices %>" 
        SelectCommand="SELECT Author.AuthorFirstName, Author.AuthorSecondName, Author.AuthorThirdName, Author.AuthorUserId, Author.AuthorPhoneNumber, Author.AuthorEmail, AuthorToPub.AuthorId FROM Author, AuthorToPub WHERE Author.AuthorId = AuthorToPub.AuthorId AND AuthorToPub.PubId = @PublicationId">
        <SelectParameters>
            <asp:Parameter Name="PublicationId" Type="String" />
        </SelectParameters>
    </asp:SqlDataSource>

    <asp:GridView ID="GridView1" runat="server" DataSourceID="SqlDataSource2" 
        DataKeyNames="Id"
            AutoGenerateColumns="False" 
        onselectedindexchanged="GridView1_SelectedIndexChanged" CellPadding="0" 
        ForeColor="#333333">
        <AlternatingRowStyle BackColor="White" />
        <Columns>
            <asp:BoundField HeaderText="Заголовок" DataField="TitleRussian" SortExpression="Title" />
            <asp:CommandField SelectText="Открыть" ShowSelectButton="true" />
        </Columns>
        <EditRowStyle BackColor="#2461BF" />
        <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
        <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
        <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
        <RowStyle BackColor="#EFF3FB" />
        <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
        <SortedAscendingCellStyle BackColor="#F5F7FB" />
        <SortedAscendingHeaderStyle BackColor="#6D95E1" />
        <SortedDescendingCellStyle BackColor="#E9EBEF" />
        <SortedDescendingHeaderStyle BackColor="#4870BE" />
    </asp:GridView>
    
    <asp:Label ID="CurrentPublicationId" Visible="false" runat="server" Text="" />
        <asp:Label ID="Label1" Visible="false" runat="server" Text="" />
        <div>
        <table runat="server" ID="PublicationInfoPanel1" Visible="false">
            <tbody>
                <tr>
                    <td>
                        <asp:Button ID="Button1" runat="server" Text="Назад" OnClick="GoToPublicationsList"  />
                    </td>
                </tr>
                <tr>
                    <td>
                        <b>Название публикации на русском языке:</b>
                    </td>
                    <td>
                        <asp:Label ID="TitleRussianLabel" runat="server" />   
                    </td>
                </tr>
                <tr>
                    <td>
                        <b>Название публикации на английском языке:</b>
                    </td>
                    <td>
                        <asp:Label ID="TitleEnglishLabel" runat="server" />   
                    </td>
                </tr>
            </tbody>
        </table>
        <table runat="server" ID="PublicationInfoPanel2" Visible="false">
            <tbody>
                <tr>
                    <td>
                        <b>Авторы:</b>
                    </td>
                </tr>
                <tr>
                    <td>
                        <asp:GridView runat="server" ID="AuthorsGridview" AutoGenerateColumns="False" 
                            DataSourceID="SqlDataSource4" CellPadding="0" ForeColor="#333333" >
                            <AlternatingRowStyle BackColor="White" />
                            <Columns>
                                <asp:BoundField DataField="AuthorFirstName" HeaderText="Фамилия" 
                                    SortExpression="AuthorFirstName" />
                                <asp:BoundField DataField="AuthorSecondName" HeaderText="Имя" 
                                    SortExpression="AuthorSecondName" />
                                <asp:BoundField DataField="AuthorThirdName" HeaderText="Отчество" 
                                    SortExpression="AuthorThirdName" />
                                <asp:BoundField DataField="AuthorPhoneNumber" HeaderText="Телефон" 
                                    SortExpression="AuthorPhoneNumber" />
                                <asp:BoundField DataField="AuthorEmail" HeaderText="Email" 
                                    SortExpression="AuthorEmail" />
                            </Columns>
                            <EditRowStyle BackColor="#2461BF" />
                            <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
                            <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
                            <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
                            <RowStyle BackColor="#EFF3FB" />
                            <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
                            <SortedAscendingCellStyle BackColor="#F5F7FB" />
                            <SortedAscendingHeaderStyle BackColor="#6D95E1" />
                            <SortedDescendingCellStyle BackColor="#E9EBEF" />
                            <SortedDescendingHeaderStyle BackColor="#4870BE" />
                        </asp:GridView>   
                    </td>
                </tr>
            </tbody>
        </table>
        <table runat="server" ID="PublicationInfoPanel3" Visible="false">
            <tbody>
                <tr>
                    <td>
                        <b>Научное направление:</b>
                    </td>
                    <td>
                        <asp:Label runat="server" ID="ScientificDirectionLabel" />
                    </td>
                </tr>
                <tr>
                    <td>
                        <b>Тип публикации:</b>
                    </td>
                    <td>
                        <asp:Label ID="TypeLabel" runat="server" />   
                    </td>
                </tr>
                <tr>
                    <td>
                        <b>Индекс УДК:</b>
                    </td>
                    <td>
                        <asp:Label ID="UDCIndexLabel" runat="server" />   
                    </td>
                </tr>
                <tr>
                    <td>
                        <b>Специальность:</b>
                    </td>
                    <td>
                        <asp:Label ID="SpecialityLabel" runat="server" />   
                    </td>
                </tr>
                <tr>
                    <td>
                        <b>Резюме на русском языке:</b>
                    </td>
                    <td>
                        <asp:TextBox EnableViewState="false" runat="server" ID="SummaryRussianTextBox" TextMode="MultiLine" Width="400px"/>  
                    </td>
                </tr>
                <tr>
                    <td>
                        <b>Резюме на английском языке:</b>
                    </td>
                    <td>
                        <asp:TextBox EnableViewState="false" runat="server" ID="SummaryEnglishTextBox" TextMode="MultiLine" Width="400px"/>  
                    </td>
                </tr>
                <tr>
                    <td>
                        <b>Ключевые слова на русском языке:</b>
                    </td>
                    <td>
                        <asp:TextBox EnableViewState="false" runat="server" ID="KeywordRussianTextBox" TextMode="MultiLine" Width="400px"/>  
                    </td>
                </tr>
                <tr>
                    <td>
                        <b>Ключевые слова на английском языке:</b>
                    </td>
                    <td>
                        <asp:TextBox EnableViewState="false" runat="server" ID="KeywordEnglishTextBox" TextMode="MultiLine" Width="400px"/>  
                    </td>
                </tr>
                <tr>
                    <td>
                        <b>Файл статьи:</b>
                    </td>
                    <td>
                        <asp:LinkButton ID="FileArtickeLinkButton" runat="server" OnClick="FileArticleLinkButton_Click"/>
                    </td>
                </tr>
                <tr>
                    <td>
                        <b>Скан сопроводительного письма:</b>
                    </td>
                    <td>
                        <asp:LinkButton ID="FileLetterLinkButton" runat="server" OnClick="FileLetterLinkButton_Click"/>
                    </td>
                </tr>
                <tr>
                    <td>
                        <b>Скан экспертного заключения:</b>
                    </td>
                    <td>
                        <asp:LinkButton ID="FileExpertLinkButton" runat="server" OnClick="FileExpertLinkButton_Click"/>
                    </td>
                </tr>
                <tr>
                    <td>
                        
                    </td>
                </tr>
                <tr>
                    <td>
                        <b>Номер квитанции об оплате:</b>
                    </td>
                    <td>
                        <asp:Label runat="server" ID="ReceiptNumberLabel" />
                    </td>
                </tr>
            </tbody>
        </table>

        <table ID="ReviewPanel" runat="server" Visible="false">
            <tbody>
                <tr>
                    <td>
                        <b>Выбрать рецензента:</b>
                    </td>
                </tr>
                <tr>
                    <td>
                    <asp:GridView runat="server" ID="ReviewersGridView" AutoGenerateColumns="False" 
                        DataKeyNames="ReviewerId" DataSourceID="SqlDataSource3" 
                            OnSelectedIndexChanged="SendPublicationToReviewer" CellPadding="0" 
                            ForeColor="#333333">
                        <AlternatingRowStyle BackColor="White" />
                        <Columns>
                            <asp:BoundField DataField="ReviewerFirstName" HeaderText="Фамилия" 
                                SortExpression="ReviewerFirstName" />
                            <asp:BoundField DataField="ReviewerLastName" HeaderText="Имя" 
                                SortExpression="ReviewerLastName" />
                            <asp:BoundField DataField="ReviewerThirdName" HeaderText="Отчество" 
                                SortExpression="ReviewerThirdName" />
                            <asp:BoundField DataField="ReviewerResearchArea" 
                                HeaderText="Научная область" SortExpression="ReviewerResearchArea" />
                            <asp:BoundField DataField="ReviewerPhoneNumber" 
                                HeaderText="Телефон" SortExpression="ReviewerPhoneNumber" />
                            <asp:BoundField DataField="ReviewerEmail" HeaderText="Email" 
                                SortExpression="ReviewerEmail" />
                            <asp:BoundField DataField="ReviewerId" HeaderText="ReviewerId" 
                                InsertVisible="False" ReadOnly="True" SortExpression="ReviewerId" Visible="false"/>
                            <asp:CommandField SelectText="Отправить на рецензию" ShowSelectButton="true" />
                        </Columns>
                        <EditRowStyle BackColor="#2461BF" />
                        <FooterStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
                        <HeaderStyle BackColor="#507CD1" Font-Bold="True" ForeColor="White" />
                        <PagerStyle BackColor="#2461BF" ForeColor="White" HorizontalAlign="Center" />
                        <RowStyle BackColor="#EFF3FB" />
                        <SelectedRowStyle BackColor="#D1DDF1" Font-Bold="True" ForeColor="#333333" />
                        <SortedAscendingCellStyle BackColor="#F5F7FB" />
                        <SortedAscendingHeaderStyle BackColor="#6D95E1" />
                        <SortedDescendingCellStyle BackColor="#E9EBEF" />
                        <SortedDescendingHeaderStyle BackColor="#4870BE" />
                    </asp:GridView>
                    </td>
                </tr>
            </tbody>
        </table>
        <table ID="ReviewFilePanel" runat="server" Visible="false">
            <tbody>
                <tr>
                    <td>
                        <b>Файл рецензии:</b>
                    </td>
                    <td>
                        <asp:LinkButton runat="server" ID="FileReviewLinkButton" />
                    </td>
                </tr>
                <tr>
                    <td>
                        <asp:Button runat="server" Text="Вернуть на доработку" OnClick="SendPublicationToAuthor"/>
                        <asp:Button runat="server" Text="Принять публикацию" OnClick="SetPublicationStateReady"/>
                    </td>
                </tr>
            </tbody>
        </table>
        </div>
</asp:Content>
